﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace NGourd
{
    class ConsoleColorer : IDisposable
    {
        private ConsoleColor original;

        public ConsoleColorer() : this(Console.ForegroundColor) { }

        public ConsoleColorer(ConsoleColor newColor)
        {
            original = Console.ForegroundColor;
            Console.ForegroundColor = newColor;
        }

        public static IDisposable RestorePoint
        {
            get
            {
                return new ConsoleColorer();
            }
        }

        #region IDisposable Members

        public void Dispose()
        {
            Console.ForegroundColor = original;
        }

        #endregion
    }
}
